#! /bin/sh

set -e

# https://www.kernel.org/pub/software/scm/git/git-2.6.6.tar.gz

SRC_parentdir=/usr/local/src
SRC_tgz=git-2.6.6.tar.gz
SRC_dir=`basename $SRC_tgz .tar.gz`


Packages="make gcc
curl-devel expat-devel
openssl-devel  zlib-devel
gettext-devel.x86_64
perl-CPAN"

for package in $Packages; do
    rpm -q $package || yum -y install $package

done


cd $SRC_parentdir
# if [ -f $SRC_tgz ]; then
if [ ! -f $SRC_tgz ]; then
    curl -LSso $SRC_tgz https://www.kernel.org/pub/software/scm/git/$SRC_tgz
    tar zxf $SRC_tgz
    cd $SRC_dir
    make prefix=/usr/local all doc info
    make prefix=/usr/local install
fi


##
